import { IPSModelSortable } from '../../ipsmodel-sortable';
import { IPSAppDEDataSet } from '../../app/dataentity/ipsapp-dedata-set';
import { IPSAppDEReport } from '../../app/dataentity/ipsapp-dereport';
import { IPSAppDEReportItem } from '../../app/dataentity/ipsapp-dereport-item';
import { IPSAppDataEntity } from '../../app/dataentity/ipsapp-data-entity';
import { IPSDataEntity } from '../ipsdata-entity';
import { IPSDEDataSet } from '../ds/ipsdedata-set';
import { IPSDEReport } from './ipsdereport';
import { IPSDEReportItem } from './ipsdereport-item';
import { IPSSysSFPlugin } from '../../res/ipssys-sfplugin';
import { IPSSysUniRes } from '../../security/ipssys-uni-res';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDEReportImpl extends PSModelObjectImpl implements IPSDEReport, IPSAppDEReport, IPSModelSortable {
  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get extendMode(): 0 | 2 {
    return this.M.extendMode != null ? this.M.extendMode : 0;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  get orderValue(): number {
    return this.M.orderValue != null ? this.M.orderValue : 99999;
  }

  get pOTime(): number {
    return this.M.pOTime != null ? this.M.pOTime : -1;
  }

  protected psappdedataset: IPSAppDEDataSet | null = null;

  getPSAppDEDataSet(): IPSAppDEDataSet | null {
    if (this.psappdedataset != null) return this.psappdedataset;
    const value = this.M.getPSAppDEDataSet;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getParentPSModelObject('app.dataentity.IPSAppDataEntity') as IPSAppDataEntity;
    if (ipsappdataentity != null) {
      this.psappdedataset = ipsappdataentity.findPSAppDEDataSet(value);
    }
    return this.psappdedataset;
  }

  get psAppDEDataSet(): IPSAppDEDataSet | null {
    return this.getPSAppDEDataSet();
  }

  getPSAppDEDataSetMust(): IPSAppDEDataSet {
    const value = this.getPSAppDEDataSet();
    if (value == null) {
      throw new Error('未指定应用实体数据集合');
    }
    return value;
  }

  protected psappdedataset2: IPSAppDEDataSet | null = null;

  getPSAppDEDataSet2(): IPSAppDEDataSet | null {
    if (this.psappdedataset2 != null) return this.psappdedataset2;
    const value = this.M.getPSAppDEDataSet2;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getParentPSModelObject('app.dataentity.IPSAppDataEntity') as IPSAppDataEntity;
    if (ipsappdataentity != null) {
      this.psappdedataset2 = ipsappdataentity.findPSAppDEDataSet(value);
    }
    return this.psappdedataset2;
  }

  get psAppDEDataSet2(): IPSAppDEDataSet | null {
    return this.getPSAppDEDataSet2();
  }

  getPSAppDEDataSet2Must(): IPSAppDEDataSet {
    const value = this.getPSAppDEDataSet2();
    if (value == null) {
      throw new Error('未指定应用实体数据集合2');
    }
    return value;
  }

  protected psappdedataset3: IPSAppDEDataSet | null = null;

  getPSAppDEDataSet3(): IPSAppDEDataSet | null {
    if (this.psappdedataset3 != null) return this.psappdedataset3;
    const value = this.M.getPSAppDEDataSet3;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getParentPSModelObject('app.dataentity.IPSAppDataEntity') as IPSAppDataEntity;
    if (ipsappdataentity != null) {
      this.psappdedataset3 = ipsappdataentity.findPSAppDEDataSet(value);
    }
    return this.psappdedataset3;
  }

  get psAppDEDataSet3(): IPSAppDEDataSet | null {
    return this.getPSAppDEDataSet3();
  }

  getPSAppDEDataSet3Must(): IPSAppDEDataSet {
    const value = this.getPSAppDEDataSet3();
    if (value == null) {
      throw new Error('未指定应用实体数据集合3');
    }
    return value;
  }

  protected psappdedataset4: IPSAppDEDataSet | null = null;

  getPSAppDEDataSet4(): IPSAppDEDataSet | null {
    if (this.psappdedataset4 != null) return this.psappdedataset4;
    const value = this.M.getPSAppDEDataSet4;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getParentPSModelObject('app.dataentity.IPSAppDataEntity') as IPSAppDataEntity;
    if (ipsappdataentity != null) {
      this.psappdedataset4 = ipsappdataentity.findPSAppDEDataSet(value);
    }
    return this.psappdedataset4;
  }

  get psAppDEDataSet4(): IPSAppDEDataSet | null {
    return this.getPSAppDEDataSet4();
  }

  getPSAppDEDataSet4Must(): IPSAppDEDataSet {
    const value = this.getPSAppDEDataSet4();
    if (value == null) {
      throw new Error('未指定应用实体数据集合4');
    }
    return value;
  }

  protected psappdereportitems: IPSAppDEReportItem[] | null = null;

  getPSAppDEReportItems(): IPSAppDEReportItem[] | null {
    if (this.psappdereportitems == null) {
      this.psappdereportitems = this.fillChildListModel(this.M.getPSAppDEReportItems, 'app.dataentity.IPSAppDEReportItem') as IPSAppDEReportItem[];
    }
    return this.psappdereportitems;
  }

  get psAppDEReportItems(): IPSAppDEReportItem[] | null {
    return this.getPSAppDEReportItems();
  }

  findPSAppDEReportItem(objKey: any): IPSAppDEReportItem | null {
    return this.getPSModel5('app.dataentity.IPSAppDEReportItem', this.getPSAppDEReportItems(), objKey) as IPSAppDEReportItem;
  }

  protected psdedataset: IPSDEDataSet | null = null;

  getPSDEDataSet(): IPSDEDataSet | null {
    if (this.psdedataset != null) return this.psdedataset;
    const value = this.M.getPSDEDataSet;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getParentPSModelObject('dataentity.IPSDataEntity') as IPSDataEntity;
    if (ipsdataentity != null) {
      this.psdedataset = ipsdataentity.findPSDEDataSet(value);
    }
    return this.psdedataset;
  }

  get psDEDataSet(): IPSDEDataSet | null {
    return this.getPSDEDataSet();
  }

  getPSDEDataSetMust(): IPSDEDataSet {
    const value = this.getPSDEDataSet();
    if (value == null) {
      throw new Error('未指定实体数据集对象');
    }
    return value;
  }

  protected psdedataset2: IPSDEDataSet | null = null;

  getPSDEDataSet2(): IPSDEDataSet | null {
    if (this.psdedataset2 != null) return this.psdedataset2;
    const value = this.M.getPSDEDataSet2;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getParentPSModelObject('dataentity.IPSDataEntity') as IPSDataEntity;
    if (ipsdataentity != null) {
      this.psdedataset2 = ipsdataentity.findPSDEDataSet(value);
    }
    return this.psdedataset2;
  }

  get psDEDataSet2(): IPSDEDataSet | null {
    return this.getPSDEDataSet2();
  }

  getPSDEDataSet2Must(): IPSDEDataSet {
    const value = this.getPSDEDataSet2();
    if (value == null) {
      throw new Error('未指定实体数据集对象2');
    }
    return value;
  }

  protected psdedataset3: IPSDEDataSet | null = null;

  getPSDEDataSet3(): IPSDEDataSet | null {
    if (this.psdedataset3 != null) return this.psdedataset3;
    const value = this.M.getPSDEDataSet3;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getParentPSModelObject('dataentity.IPSDataEntity') as IPSDataEntity;
    if (ipsdataentity != null) {
      this.psdedataset3 = ipsdataentity.findPSDEDataSet(value);
    }
    return this.psdedataset3;
  }

  get psDEDataSet3(): IPSDEDataSet | null {
    return this.getPSDEDataSet3();
  }

  getPSDEDataSet3Must(): IPSDEDataSet {
    const value = this.getPSDEDataSet3();
    if (value == null) {
      throw new Error('未指定实体数据集对象3');
    }
    return value;
  }

  protected psdedataset4: IPSDEDataSet | null = null;

  getPSDEDataSet4(): IPSDEDataSet | null {
    if (this.psdedataset4 != null) return this.psdedataset4;
    const value = this.M.getPSDEDataSet4;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getParentPSModelObject('dataentity.IPSDataEntity') as IPSDataEntity;
    if (ipsdataentity != null) {
      this.psdedataset4 = ipsdataentity.findPSDEDataSet(value);
    }
    return this.psdedataset4;
  }

  get psDEDataSet4(): IPSDEDataSet | null {
    return this.getPSDEDataSet4();
  }

  getPSDEDataSet4Must(): IPSDEDataSet {
    const value = this.getPSDEDataSet4();
    if (value == null) {
      throw new Error('未指定实体数据集对象4');
    }
    return value;
  }

  protected psdereportitems: IPSDEReportItem[] | null = null;

  getPSDEReportItems(): IPSDEReportItem[] | null {
    if (this.psdereportitems == null) {
      this.psdereportitems = this.fillChildListModel(this.M.getPSDEReportItems, 'dataentity.report.IPSDEReportItem') as IPSDEReportItem[];
    }
    return this.psdereportitems;
  }

  get psDEReportItems(): IPSDEReportItem[] | null {
    return this.getPSDEReportItems();
  }

  findPSDEReportItem(objKey: any): IPSDEReportItem | null {
    return this.getPSModel5('dataentity.report.IPSDEReportItem', this.getPSDEReportItems(), objKey) as IPSDEReportItem;
  }

  protected pssyssfplugin: IPSSysSFPlugin | null = null;

  getPSSysSFPlugin(): IPSSysSFPlugin | null {
    if (this.pssyssfplugin != null) return this.pssyssfplugin;
    const value = this.M.getPSSysSFPlugin;
    if (value == null) {
      return null;
    }
    this.pssyssfplugin = this.getPSModel4('res.IPSSysSFPlugin', value, 'getPSSysSFPlugin') as IPSSysSFPlugin;
    return this.pssyssfplugin;
  }

  get psSysSFPlugin(): IPSSysSFPlugin | null {
    return this.getPSSysSFPlugin();
  }

  getPSSysSFPluginMust(): IPSSysSFPlugin {
    const value = this.getPSSysSFPlugin();
    if (value == null) {
      throw new Error('未指定后台扩展插件');
    }
    return value;
  }

  protected pssysunires: IPSSysUniRes | null = null;

  getPSSysUniRes(): IPSSysUniRes | null {
    if (this.pssysunires != null) return this.pssysunires;
    const value = this.M.getPSSysUniRes;
    if (value == null) {
      return null;
    }
    this.pssysunires = this.getPSModel4('security.IPSSysUniRes', value, 'getPSSysUniRes') as IPSSysUniRes;
    return this.pssysunires;
  }

  get psSysUniRes(): IPSSysUniRes | null {
    return this.getPSSysUniRes();
  }

  getPSSysUniResMust(): IPSSysUniRes {
    const value = this.getPSSysUniRes();
    if (value == null) {
      throw new Error('未指定权限统一资源对象');
    }
    return value;
  }

  get reportFile(): string {
    return this.M.reportFile;
  }

  get reportModel(): string {
    return this.M.reportModel;
  }

  get reportType(): string {
    return this.M.reportType;
  }

  get sysUniResCode(): string {
    return this.M.sysUniResCode;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get enableLog(): boolean {
    return this.M.enableLog != null ? this.M.enableLog : false;
  }

  get multiPage(): boolean {
    return this.M.multiPage != null ? this.M.multiPage : false;
  }

  get cls(): string {
    return 'PSDEReportImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'IPSModelSortable' || cls == 'app.dataentity.IPSAppDEReport' || cls == 'app.dataentity.IPSAppDataEntityObject' || cls == 'dataentity.report.IPSDEReport') return true;
    return super.instanceof(cls);
  }
}
